// 当前这个模块：API统一进行管理
import requests from './request'
import mockRequests from './mockAjax'
import store from '@/store';
// 三级菜单的请求地址 /api/product/getBaseCategoryList Get没有任何参数
// 对外暴露一个函数，只要外部调用这个函数，就向服务器发起ajax请求、获取咱们的三级菜单数据。当前这个函数
// 只需要把服务器返回结果返回即可。
export const reqCategoryList = () => requests({ url: '/api/product/getBaseCategoryList', method: 'get' })

export const reqGetBannerList = () => mockRequests.get('/banner');
export const reqGetFloorList = () => mockRequests.get('/floor');
export const reqGetSearchList = (params) => requests({ url: "api/list", method: "post", data: params })
// 获取产品详情信息的接口 URL: /api/item/{skuid} 请求方式
export const reqGoodsInfo = (skuId) => requests({ url: `api/item/${skuId}`, method: 'get' })

// 将产品添加到购物车中(获取更新某一个产品的个数)

export const reqAddOrUpdateShopCart = (skuId, skuNum) => requests({ url: `api/cart/addToCart/${skuId}/${skuNum}`, method: "post" })
// 获取购物车数据接口
// URL:/api/cart/cartList method：get
export const shopCart = () => requests({ url: 'api/cart/cartList', method: 'get' })
// 删除购物车接口
// URL:/api/cart/deleteCART/{skuid} method:delete
export const deletCartlist = (skuId) => requests ({url:`/api/cart/deleteCart/${skuId}`,method:'delete'})
// 获取购物车产品的勾选状态
export const reqUpdateCheckedByid = (skuId,isChecked) => requests ({url:`/api/cart/checkCart/${skuId}/${isChecked}`,method:'get'})
// 获取验证码---/api/user/passport/sendCode{phone}
export const reqSendCode = (phone) => requests({url:`/api/user/passport/sendCode/${phone}`,method:'get'})
// 获取注册接口--url:/api/user/passport/register method:post phone code passwprd
export const reqRegister = (data) => requests({url:'/api/user/passport/register/',data,method:'post'})
// 获取登录接口--url:/api/user/passport/login
export const reqLogin = (data) => requests({url:'/api/user/passport/login/',data,method:'post'})
// 获取用户信息【需要带着用户的token向服务器要用户信息】
// URL:/api/user/passport/auth/getUserInfo method:get
export const requserInfo = () => requests({url:`api/user/passport/auth/getUserInfo`,method:'get'})
// 退出登录发服务器 url:/api/user/passport/logout get
export const reqlogout = () => requests({url:`api/user/passport/logout`,method:'get'})
// 获取用户地址
export const reqAddressInfo = () => requests({url:`/api/user/userAddress/auth/findUserAddressList`,method:'get'})
// 获取购买清单
export const reqOrderInfo = () => requests({url:'/api/order/auth/trade',method:'get'})
